﻿using Application.AppService;
using AutoMapper;
using Domain.Entity;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace UI.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class StudentController : ControllerBase
    {
        private readonly IStudentAppService studentAppService;
        private readonly IMapper mapper;

        public StudentController(IStudentAppService studentAppService, IMapper mapper)
        {
            this.studentAppService = studentAppService;
            this.mapper = mapper;
        }
        [HttpPost]
        public async Task<int> StudentAdd(StudentAddDto studentAddDto)
        {

            //StudentAddDto->Student
            Students student = mapper.Map<Students>(studentAddDto);
          return  await studentAppService.StudentAddAsync(student);

            
        }
    }
}
